﻿@using QuestionsAnswers.UI.Models
@model CourseMemberIds
@{
    ViewBag.Title = "Invite new " + Model.MemberType;
}
<div id="updateUsers" style="color: red">
</div>
<h2>
    Invite @Model.MemberType</h2>
<script type="text/javascript">    function Invited() {
        $('#updateUsers').html('Users Successfully Invited');
        $('textarea').attr('value', "");

    }
    function InviteFail() {
        $('#updateUsers').html('Invalid Invite');
        $('textarea').attr('value', "");
    }
    function clearContents() {
        $("#updateUsers").empty();
    }
</script>
@using (Ajax.BeginForm(new AjaxOptions { OnSuccess = "Invited", OnFailure = "InviteFail" }))
{     
    <p>
        Enter the Email Adressses to Invite (one per line)</p> 

    @Html.TextArea("email", "", 10, 50, new { id = "emails", onclick = "$('#updateUsers').empty();" })
    <br />
    @Html.RadioButtonFor(model => model.MemberType, "Participant") @:Participant
     @Html.RadioButtonFor(model => model.MemberType, "Owner") @:Owner
                                   
    <br />
    
    <button name="Invite" value="Invite Member">
        Invite</button>
}